/************************************************************************
 * <br>
 * <ul>
 * <li>版权所有：唐山弘川科技有限公司 2009－2020</li>
 * <li>创建日期：2009-8-10</li>
 * <li>初始作者：刘川</li>
 * </ul>
 * <ul>
 * <b>修订历史</b>
 * <li>1、</li>
 * </ul>
 ***********************************************************************/
package com.hy.enterprise.framework.persistence.domain.query.conditions ;

import com.hy.enterprise.framework.persistence.domain.query.internal.AliasFactory;

/**
 * <ul>
 * <li>设计作者：刘川</li>
 * <li>设计日期：2009-8-10</li>
 * <li>设计时间：下午03:14:15</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订历史</b>
 * <li>1、</li>
 * </ul>
 */
public class BinaryExpression < L , R > extends ConditionalExpression
{
	private final L	        lhs ;

	private final IOperator	operator ;

	private final R	        rhs ;

	/**
	 * 构造函数
	 * 
	 * @param lhs
	 * @param operator
	 * @param rhs
	 */
	public BinaryExpression (
	                          L lhs ,
	                          IOperator operator ,
	                          R rhs )
	{
		this.lhs =
		           lhs ;
		this.operator =
		                operator ;
		this.rhs =
		           rhs ;
	}

	/**
	 * @see com.hy.enterprise.framework.persistence.domain.query.internal.managedobjects.LibraManagedObject#getTargetRepresentation()
	 */
	@ Override
	public String getTargetRepresentation ( )
	{
		StringBuilder stringBuilder =
		                              new StringBuilder ( ) ;
		// lhs
		stringBuilder
		             .append ( AliasFactory
		                                   .safeStringForm ( this.lhs ) ) ;
		// op
		stringBuilder
		             .append ( this.operator
		                                    .getStringRepresentation ( ) ) ;
		// rhs
		stringBuilder
		             .append ( AliasFactory
		                                   .safeStringForm ( this.rhs ) ) ;
		return stringBuilder
		                    .toString ( ) ;
	}
}
